Performance of batches with Statements and PreparedStatements - Mailing list pgsql-jdbc

From Jeff Kolesky
Subject Performance of batches with Statements and PreparedStatements
Date
Msg-id a05200f02bab8d618e684@[192.168.1.9]
Whole thread Raw
Responses Re: Performance of batches with Statements and PreparedStatements
List pgsql-jdbc
I have some code that is inserting many rows into the database,
executing Statements repeatedly. I can run the inserts as batches
using the JDBC batch functionality, or I can concatenate the inserts
with semi-colons and execute one large statement.

If I take the semi-colon approach, I cannot use a PreparedStatement
easily, which is fine.  I read somewhere that the implementation of
executeBatch() just executes all of the statements one-by-one, which
would be as slow as executing separate statements.

I would like some advice as to which method would run faster and if
using PreparedStatements is a good performance boost.

Is there any limit to the number of statements that can be executed in a batch?

All advice is greatly appreciated.

Thanks.

Jeff


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: JDBC
Next
From: Peter Royal
Date:
Subject: Index metadata not sorted by ORDINAL_POSITION